<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script type="text/javascript">
		var count = 1;
		var count1 = 1;
		while (count <= 2 && count1 <= 2) {
			var ren = '';
			while (!(ren == '剪刀' || ren == '布' || ren == '石头')) {
				var ren = prompt("请输入剪刀石头布")
			}
			var num = Math.random() * 3 + 1;
			var computer = Math.floor(num);
			if (computer == 1) {
				alert("电脑出的剪刀");
			} else if (computer == 2) {
				alert("电脑出的石头");
			} else {
				alert("电脑出的布");
			}
			if ((ren == "剪刀" && computer == 1)
					|| (ren == "石头" && computer == 2)
					|| (ren == "布" && computer == 3)) {
				alert('平局');
			} else if ((ren == "剪刀" && computer == 2)
					|| (ren == "石头" && computer == 3)
					|| (ren == "布" && computer == 1)) {
				alert("电脑胜出")
				count1++;
			} else {
				alert("您胜利了")
				count++;
			}
		}
		if (count > 2) {
			alert("恭喜您获得了最终胜利！~~")
		} else {
			alert("很遗憾，您输了/(ㄒoㄒ)/~~")
		}
		console.log(count);
		console.log(count1);
		</script>
</body>
</html>